// Auto-Fill Plugin
// Written by Joe Sak http://www.joesak.com/2008/11/19/a-jquery-function-to-auto-fill-input-fields-and-clear-them-on-click/
(function($){
	$.fn.autofill=function(options){
		var defaults={
				value:"slaapwel",
				defaultTextColor:"#b2adad",
				activeTextColor:"#333"};
		
		var options=$.extend(defaults,options);
		
		return this.each(
				function(){
					var obj=$(this);
					obj.css({color:options.defaultTextColor});
					obj.val(obj.attr('rel'));
										
					obj.focus(
							function(){
								//alert(obj.val() + " : " + obj.attr('rel'));
								if(obj.val()==obj.attr('rel')){
									obj.val("").css({color:options.activeTextColor});
								}
							}
							)
							
					obj.blur(
							function(){
								if(obj.val()==""){
									obj.css({color:options.defaultTextColor}).val(obj.attr('rel'));
								}
							}
						);
				}
			);
	};
})(jQuery);